/*
 * @Author: zhuxiaoyi
 * @Date: 2021-10-29 09:45:01
 * @LastEditor: zhuxiaoyi
 * @LastEditTime: 2023-07-16 19:23:45
 * @Description: token相关操作
 */
import Cookies from "js-cookie";

const TokenKey = "exam_platform_token";
const hour = 6; //失效时间是几小时
let settime = new Date(new Date().getTime() + hour * 60 * 60 * 1000);

export function getToken() {
  return Cookies.get(TokenKey);
}

export function setToken(token: any, time = settime) {
  return Cookies.set(TokenKey, token, { expires: time });
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}
